<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>

        div{
            margin: auto;
            width: 300px;
            height: 300px;
            border: 1px solid red;
        }
        img{
            width: 100%;
            height: 100%;
            object-fit: cover;  //注意其浏览器的兼容性
        }

    </style>
</head>
<body>
    <div>
        <img src="http://www.ylefu.com/zb_users/upload/2017/06/20170628210846_81752.jpeg" alt="图片原尺寸：256*192">
    </div>
</body>
</html>